package file.day9_17;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("fosCopy.dat");
        FileInputStream fis = new FileInputStream("fos.dat");
        int a;
        long start = System.currentTimeMillis();
        while ((a = fis.read()) != -1){    //单个复制
            fos.write(a);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完毕，耗时："+(end-start)+"ms");
        fis = new FileInputStream("fosCopy.dat");
        while ((a = fis.read()) != -1){
            System.out.println(a);
        }
        fos.close();
        fis.close();

    }
}
